extern "C"
{
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libavutil/avutil.h"
#include "libswscale/swscale.h"
};

#include <string>
using namespace std;

class CoderToJpg
{
public:
	CoderToJpg();
	~CoderToJpg();

public:
	void setWidth(const int p_nWidth);
	void setHeight(const int p_nHeight);
	int init();
	int coderFrameToPic(AVFrame* p_pobjAVFrame, const string& p_strJpgFileName);
	void close();

private:
	AVFormatContext*	m_pobjJpgAVFormatContext;
	AVOutputFormat*		m_pobjAVOutputFormat;
	AVStream*			m_pobjAVStream;
	AVCodecContext*		m_pobjJpgAVCodecCtx;
	AVCodec*			m_pobjJpgAVCodec;
	AVPacket*			m_pobjJpgAVPacket;
	int					m_nWidth;
	int					m_nHeight;
};
